unit u_camera;

interface

uses
  u_input,
  System.Windows.Forms,
  Microsoft.DirectX.DirectInput,
  Microsoft.DirectX.Direct3DX,
  Microsoft.DirectX.Direct3D,
  Microsoft.DirectX,
  u_form;

type

c_camera = class

  private
    zoom: real;
    teta : real;
    phi : real;
    myinput : c_input;
    myform : System.windows.Forms.Form;
    xcam,ycam,zcam : integer;
    myf : c_form;
  public
    procedure initcam( device: device; width, height, phi, teta, zoom: integer);
//    procedure update(device: device);
    procedure keydown( e : KeyEventArgs);

end;


implementation

procedure c_camera.initcam;
begin
  teta := 0;
  phi := 0;
  xcam:=0;
  ycam:=5;
  zcam:=2;
  zoom := 0;
  device.transform.view := matrix.lookatlh(Vector3.Create(zoom * sin(teta)+ 10,zoom + 30,zoom * cos(teta) -30),
                                                          Vector3.Create(20, 20, 0),
                                                          Vector3.Create(0, 1, 0));
  device.transform.projection := matrix.perspectivefovlh(math.pi / 4,
                                                         width / height,
                                                         0.1,
                                                         15000.0);
  myinput := c_Input.Create;
  myinput := c_input.keyandmousecreate;
  myinput.InitializeKeyboard(myform);
end;



//procedure c_camera.update(device: device);
//begin
//  device.transform.view := Matrix.rotationY(teta) *
//                           Matrix.rotationx(phi) *
//                           matrix.translation(xcam + zoom, ycam + zoom , zcam + zoom);//je pense lol
//end;

end.
